import { reqGetProjectCostRank, reqGetProjectListWithState, reqGetTeacherPopularity } from "@/api";
import { Message } from "element-ui";
export default({
    namespaced:true,
    actions:{
        async getTeacherPopulartion(context){
            let result=await reqGetTeacherPopularity();
            if(result.code==='200'){
                context.commit('getTeacherPopulartion',result.other)
            }else{
                Message({
                    message: '警告!'+'['+result.code+']'+'['+result.message+']',
                    type: 'warning'
                })
                return;
            }
        },
        async getProjectCostRank(context){
            let result=await reqGetProjectCostRank();
            if(result.code==='200'){
                context.commit('getProjectCostRank',result.other)
            }else{
                Message({
                    message: '警告!'+'['+result.code+']'+'['+result.message+']',
                    type: 'warning'
                })
                return;
            }
        },
        async getProjectListWithState(context){
            let result=await reqGetProjectListWithState();
            if(result.code==='200'){
                context.commit('getProjectListWithState',result.other)
            }else{
                Message({
                    message: '警告!'+'['+result.code+']'+'['+result.message+']',
                    type: 'warning'
                })
                return;
            }
        }
    },
    mutations:{
        getTeacherPopulartion(state,value){
            state.teacherPopulartionList=value;
        },
        getProjectCostRank(state,value){
            state.costRankDataList=value;
        },
        getProjectListWithState(state,value){
            state.projectListWithState=value;
        }
    },
    state:{
        teacherPopulartionList:[],
        costRankDataList:[],
        projectListWithState:[]
    },
    getters:{
        
    }
})